//
//  LanguageLearnViewController.m
//  iOSCodeLearning
//
//  Created by Ace on 2017/10/31.
//  Copyright © 2017年 Ace. All rights reserved.
//

// vc
#import "LanguageLearnViewController.h"
#import "DataViewController.h"
#import "StaticViewController.h"
#import "NSScannerViewController.h"
#import "UITestViewController.h"
#import "UITestTableViewController.h"
#import "BlockViewController.h"
#import "UIApplicationViewController.h"
#import "MessageTransmitViewController.h"
#import "DelegateViewController.h"
#import "BoundsViewController.h"
#import "RuntimeViewController.h"

// UI
#import "CommonTableViewCell.h"




@interface LanguageLearnViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableview;

@property(nonatomic,strong) NSMutableArray  *titles;

@property (nonatomic, strong) NSString *strongString;
@property (nonatomic, copy)  NSString *copystr;

@end

@implementation LanguageLearnViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self p_initTitles];
     NSUUID *uuid = [UIDevice currentDevice].identifierForVendor;
    NSMutableString *mutString = [NSMutableString stringWithString:@"1111"];
    self.strongString = mutString;
    self.copystr = mutString;
    [mutString appendString:@"2222"];
    
    
//    NSLog(@"%p muString:%@",mutString,mutString);
//    NSLog(@"%p strongString:%@",self.strongString,self.strongString);
//    NSLog(@"%p copyString:%@",self.copystr,self.copystr);
    
}

-(void)p_initTitles{
    [self.titles addObject:@"位移枚举"];
    [self.titles addObject:@"static const  extern"];
    [self.titles addObject:@"NSScanner"];
    [self.titles addObject:@"UITestEsay"];
    [self.titles addObject:@"UITestTableView"];
    [self.titles addObject:@"block"];
    [self.titles addObject:@"UIApplication相关"];
    [self.titles addObject:@"消息转发"];
    [self.titles addObject:@"代理"];
    [self.titles addObject:@"bounds"];
    [self.titles addObject:@"Runtime"];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.titles.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    CommonTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CommonTableViewCellID"];
    cell.titleLabel.text = self.titles[indexPath.row];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    switch (indexPath.row) {
        case 0:
        {
            DataViewController *vc= [[DataViewController alloc]init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 1:
        {
            StaticViewController *vc = [[StaticViewController alloc]init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 2:
        {
            NSScannerViewController *vc = [[NSScannerViewController alloc]init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 3:
        {
            UITestViewController *vc = [[UITestViewController alloc]init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 4:
        {
            UITestTableViewController *vc = [[UITestTableViewController alloc] init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 5:
        {
            BlockViewController *vc = [[BlockViewController alloc] init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 6:
        {
            UIApplicationViewController *vc = [[UIApplicationViewController alloc] initWithNibName:@"UIApplicationViewController" bundle:nil];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 7:
        {
            MessageTransmitViewController *messageVC = [[MessageTransmitViewController alloc] init];
            messageVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:messageVC animated:YES];
        }
            break;
        case 8:
        {
            DelegateViewController *vc = [[DelegateViewController alloc] init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 9:
        {
            BoundsViewController *vc = [[BoundsViewController alloc]init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 10:
        {
            RuntimeViewController *vc = [[RuntimeViewController alloc] init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
        default:
            break;
    }
}

//  cell编辑状态相关代码
//-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
//
//
//
//}
//
//-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
//
//    return YES;
//}
//
//-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
//    return   UITableViewCellEditingStyleDelete;
//}


// cell 侧滑相关的代码
//-(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
//
//
//}



-(NSMutableArray *)titles{
    if (!_titles) {
        _titles = [NSMutableArray array];
    }
    return _titles;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



@end
